﻿<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="FlowSchema" targetNamespace="http://schemas.microsoft.com/dsltools/Flow" elementFormDefault="qualified" xmlns="http://schemas.microsoft.com/dsltools/Flow" xmlns:core="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import id="CoreSchema" namespace="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" />
  <!-- FlowModel -->
  <xsd:element name="flowModel" type="FlowModel" substitutionGroup="core:modelElement" />
  <xsd:complexType name="FlowModel">
    <xsd:annotation>
      <xsd:documentation>The root in which all other elements are embedded. Appears as a diagram.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: FlowModelHasElements -->
          <xsd:element name="elements" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instances of FlowModelHasElements</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:choice minOccurs="0" maxOccurs="unbounded" >
                  <xsd:element ref="flowModelHasElements">
                    <xsd:annotation>
                      <xsd:documentation>[Relationship deriving from FlowModelHasElements needs to be serialized in full-form]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                  <xsd:element ref="flowElement" >
                    <xsd:annotation>
                      <xsd:documentation>[Target role-player]</xsd:documentation>
                    </xsd:annotation>
                  </xsd:element>
                </xsd:choice>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <!-- dslVersion -->
        <xsd:attribute name="dslVersion" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Version of the model serialized in this file.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FlowModel Moniker -->
  <xsd:element name="flowModelMoniker" type="FlowModelMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="FlowModelMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for FlowModel instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FlowElement -->
  <xsd:element name="flowElement" abstract="true" type="FlowElement" substitutionGroup="core:modelElement" />
  <xsd:complexType name="FlowElement" abstract="true" >
    <xsd:annotation>
      <xsd:documentation>Elements embedded in the model. Appear as boxes on the diagram.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Relationship: FlowElementReferencesTargetFlowElements -->
          <xsd:element name="targetFlowElements" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>Instances of FlowElementReferencesTargetFlowElements</xsd:documentation>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element ref="flowElementReferencesTargetFlowElements" minOccurs="0" maxOccurs="unbounded">
                  <xsd:annotation>
                    <xsd:documentation>[Instance of FlowElementReferencesTargetFlowElements needs to be serialized in full-form]</xsd:documentation>
                  </xsd:annotation>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
        <!-- Property: Name -->
        <xsd:attribute name="name" type="xsd:string" use="required" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FlowElement Moniker -->
  <xsd:element name="flowElementMoniker" abstract="true" type="FlowElementMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="FlowElementMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for FlowElement instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="name" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- StartPoint -->
  <xsd:element name="startPoint" type="StartPoint" substitutionGroup="flowElement" />
  <xsd:complexType name="StartPoint">
    <xsd:complexContent>
      <xsd:extension base="FlowElement">
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- StartPoint Moniker -->
  <xsd:element name="startPointMoniker" type="StartPointMoniker" substitutionGroup="flowElementMoniker" />
  <xsd:complexType name="StartPointMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for StartPoint instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="FlowElementMoniker">
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- EndPoint -->
  <xsd:element name="endPoint" type="EndPoint" substitutionGroup="flowElement" />
  <xsd:complexType name="EndPoint">
    <xsd:complexContent>
      <xsd:extension base="FlowElement">
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- EndPoint Moniker -->
  <xsd:element name="endPointMoniker" type="EndPointMoniker" substitutionGroup="flowElementMoniker" />
  <xsd:complexType name="EndPointMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for EndPoint instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="FlowElementMoniker">
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Operation -->
  <xsd:element name="operation" type="Operation" substitutionGroup="flowElement" />
  <xsd:complexType name="Operation">
    <xsd:complexContent>
      <xsd:extension base="FlowElement">
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Operation Moniker -->
  <xsd:element name="operationMoniker" type="OperationMoniker" substitutionGroup="flowElementMoniker" />
  <xsd:complexType name="OperationMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for Operation instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="FlowElementMoniker">
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FlowModelHasElements -->
  <xsd:element name="flowModelHasElements" abstract="true" type="FlowModelHasElements" substitutionGroup="core:modelElement" />
  <xsd:complexType name="FlowModelHasElements" abstract="true" >
    <xsd:annotation>
      <xsd:documentation>Embedding relationship between the Model and Elements</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end FlowElement -->
          <xsd:element ref="flowElement" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FlowModelHasElements Moniker -->
  <xsd:element name="flowModelHasElementsMoniker" type="FlowModelHasElementsMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="FlowModelHasElementsMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for FlowModelHasElements instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FlowElementReferencesTargetFlowElements -->
  <xsd:element name="flowElementReferencesTargetFlowElements" type="FlowElementReferencesTargetFlowElements" substitutionGroup="core:modelElement" />
  <xsd:complexType name="FlowElementReferencesTargetFlowElements">
    <xsd:complexContent>
      <xsd:extension base="core:ModelElement">
        <xsd:sequence minOccurs="0" maxOccurs="1">
          <!-- Target end FlowElement -->
          <xsd:element ref="flowElementMoniker" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>[Target role-player]</xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
        <!-- Id -->
        <xsd:attribute name="Id" type="xsd:string">
          <xsd:annotation>
            <xsd:documentation>Instance Guid of this element, needed because SerializeId is set to true.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- FlowElementReferencesTargetFlowElements Moniker -->
  <xsd:element name="flowElementReferencesTargetFlowElementsMoniker" type="FlowElementReferencesTargetFlowElementsMoniker" substitutionGroup="core:modelElementMoniker" />
  <xsd:complexType name="FlowElementReferencesTargetFlowElementsMoniker">
    <xsd:annotation>
      <xsd:documentation>Moniker for FlowElementReferencesTargetFlowElements instance.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexContent>
      <xsd:extension base="core:ModelElementMoniker">
        <xsd:attribute name="Id" type="xsd:string" >
          <xsd:annotation>
            <xsd:documentation>Attribute to store the moniker string.</xsd:documentation>
          </xsd:annotation>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
</xsd:schema>

